raw = read.csv("~/HOLA/research/Green_jobs/data/original_well_data/tx_completion_DH_onlyF_31455.csv")

wellscount = read.table("~/HOLA/research/Green_jobs/data/TX/wellscount_tx.txt", sep = ",")

head(wellscount)
names(wellscount) = c("county","year","wells","gas","oil","others")
dim(wellscount)
sum(wellscount$wells)
wells2001 = subset(wellscount,wellscount$year>=2001)
wells2001 = subset(wells2001,wells2001$year<2012)

dim(wells2001)
sum(wells2001$wells)

wellscount = wells2001[-grep("[LS]B",wells2001$county),]
sum(wellscount$wells)
sum(wellscount$oil)
sum(wellscount$gas)
sum(wellscount$others)
names(raw)
attach(raw)
x = grep("2001",Spud.Date)
x = c(x, grep("2002",Spud.Date))
x = c(x, grep("2003",Spud.Date))
x = c(x, grep("2004",Spud.Date))
x = c(x, grep("2005",Spud.Date))
x = c(x, grep("2006",Spud.Date))
x = c(x, grep("2007",Spud.Date))
x = c(x, grep("2008",Spud.Date))
x = c(x, grep("2009",Spud.Date))
x = c(x, grep("2010",Spud.Date))
x = c(x, grep("2011",Spud.Date))
raw = raw[x,]
y = grep("-", County)
raw = raw[-grep("-", County),]
rawothers = raw[-grep("[OG]",raw$Well.Type),]
length(grep("U",raw$Well.Type))
